package com.qf.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.jetbrains.annotations.NotNull;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("user")  // 该类对应的数据库中的表名
public class User implements Comparable<User>{

    // 处理主键自增注解
    @TableId(value = "user_id",type = IdType.AUTO)
    private Integer userId;

    private String username;

    private String password;

    // 非主键，使用如下注解
    @TableField("user_img")
    private String userImg;

    @TableField("user_regtime")
    private Date userRegtime;

    // 盐
    private String salt;

    private String phone;

    @Override
    public int compareTo(@NotNull User o) {
        return o.getUserId()-this.userId;
    }
}
